import 'package:flutter/material.dart';
import 'dart:ui' as ui;

class TextStyleWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('TextStyle基本属性')),
        body: SingleChildScrollView(
            child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            SizedBox(height: 8),
            Text('文字颜色: TextStyle(color: Colors.red)',
                style: TextStyle(color: Colors.red)),
            SizedBox(height: 8),
            Text('文字颜色1: TextStyle(foreground: Paint()..color = Colors.pink)',
                style: TextStyle(foreground: Paint()..color = Colors.red)),
            SizedBox(height: 8),
            Text('背景色: TextStyle(backgroundColor: Colors.pink)',
                style: TextStyle(backgroundColor: Colors.pink)),
            SizedBox(height: 8),
            Text('背景色1: TextStyle(background: Paint()..color = Colors.pink)',
                style: TextStyle(background: Paint()..color = Colors.pink)),
            SizedBox(height: 8),
            Text('字体大小: `style: TextStyle(fontSize: 18)`',
                style: TextStyle(fontSize: 18)),
            SizedBox(height: 8),
            Text('加粗: `style: TextStyle(fontWeight: FontWeight.bold)`',
                style: TextStyle(fontWeight: FontWeight.bold)),
            SizedBox(height: 8),
            Text('斜体: `TextStyle(fontStyle: FontStyle.italic)`',
                style: TextStyle(fontStyle: FontStyle.italic)),
            SizedBox(height: 8),
            Text('字母间距: TextStyle(letterSpacing: 3)',
                style: TextStyle(letterSpacing: 3)),
            SizedBox(height: 8),
            Text('单词间距: TextStyle(wordSpacing: 35)',
                style: TextStyle(wordSpacing: 35)),
            SizedBox(height: 8),
            Text("字体: TextStyle(fontFamily: 'Courier')",
                style: TextStyle(fontFamily: 'Courier')),
            SizedBox(height: 8),
            Text('''
设置行高, 单位: 倍
第一部分
1111
22
第二部分
333
44
第三部分
''', style: TextStyle(height: 3)),
            Text('xxx'),
            Text("阴影: TextStyle(shadows: [..])",
                style: TextStyle(shadows: [
                  Shadow(
                    offset: Offset(10.0, 10.0),
                    blurRadius: 3.0,
                    color: Color.fromARGB(255, 0, 0, 0),
                  ),
                  Shadow(
                    offset: Offset(10.0, 10.0),
                    blurRadius: 8.0,
                    color: Color.fromARGB(125, 0, 0, 255),
                  )
                ])),
            SizedBox(height: 8),
            Text("描边: foreground: Paint()..style = PaintingStyle.stroke",
                style: TextStyle(
                    fontSize: 30,
                    foreground: Paint()
                      ..style = PaintingStyle.stroke
                      ..strokeWidth = 1
                      ..color = Colors.blue)),
            Text("渐变色: foreground: Paint()..shader = ui.Gradient.linear",
                style: TextStyle(
                    fontSize: 30,
                    foreground: Paint()
                      ..shader = ui.Gradient.linear(const Offset(0, 20),
                          const Offset(150, 20), [Colors.red, Colors.yellow]))),
          ],
        )));
  }
}
